<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<script src="js/jquery-3.1.1.js" type="text/javascript" charset="utf-8"></script>
		<link rel="stylesheet" type="text/css" href="css/index.css"/>
		<title></title>
	</head>
	<body>
		<div class="da">
		<div class="ss">
			<input type="text" />
			<button>搜索</button>
			<div></div>
		</div>
		<div class="nav">
			<ul>
				<li>
					<div class="tp"><img src="img/2017-09-15_143335_02.png"/></div>
					<div class="wz"><div class="pp"><div></div><h4>肖申克的救赎</h4><span>9.6</span></div>
					<p>原名: <span>Shawshank Redemption</span> </p>
						<p>导演:</p>
						<p>主演: <span>二狗子,王麻子,王铁锤</span> </p>
						<p>类型: <span>犯罪 剧情</span></p>
						<p>年份: <span>1994</span></p>
					</div>
				</li>
				<!--<li>
					<div class="tp"><img src="images/2017-09-15_143335_04.jpg"/></div>
					<div class="wz"><div class="pp"><div></div><h4>霸王别姬</h4><span>9.5</span></div>
					<p>原名: <span>霸王别姬</span> </p>
						<p>导演:</p>
						<p>主演: <span>二狗子,王麻子,猪刚鬣，王铁锤</span> </p>
						<p>类型: <span>剧情 爱情 同性</span></p>
						<p>年份: <span>1993</span></p>
					</div>
				</li>
				<li>
					<div class="tp"><img src="images/2017-09-15_143335_04.jpg"/></div>
					<div class="wz"><div class="pp"><div></div><h4>霸王别姬</h4><span>9.5</span></div>
					<p>原名: <span>霸王别姬</span> </p>
						<p>导演:</p>
						<p>主演: <span>二狗子,王麻子,猪刚鬣，王铁锤</span> </p>
						<p>类型: <span>剧情 爱情 同性</span></p>
						<p>年份: <span>1993</span></p>0
					</div>
				</li>-->
			</ul>
		</div>
		</div>
		<script>
			$.ajax({
				type:"get",
				url:"tsconfig.json",
				async:true,
				dataType:"json",
				success:function(data){
					console.log(data.subjects)
					var arr=data.subjects;
					var html='';
					for(var i=0;i<arr.length;i++){
						html+='<li><div class="tp"><img src="'+arr[i].images.large+'"/></div><div class="wz"><div class="pp"><div></div><h4>'+arr[i].title+'</h4><span>'+arr[i].rating.average+'</span></div><p>原名: <span>'+arr[i].original_title+'</span> </p><p>导演:<span>'+arr[i].directors[0].name+'</span></p><p>主演: <span>'+arr[i].casts[0].name+'</span> </p><p>类型: <span>'+arr[i].genres[0]+'</span></p><p>年份: <span>'+arr[i].year+'</span></p></div></li>'
					}
					
				
//				function getStr(arr,attr) {
//                  var str=""
//					if(attr!==undefined){
//                      for (var i=0;i<arr.length;i++){
//                          str+=arr[i].attr
//                      }
//					}else {
//                      for (var i=0;i<arr.length;i++){
//                          str+=arr[i];
//                      }
//					}
//
//
//					return str;
//              }
				
				$(".nav ul").html(html)
			}}
			
			);
			
			
		</script>
	</body>
</html>